package com.krediti.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

@Entity
@Table(name = "UGOVOROKREDITU")
public class UgovorOKreditu implements java.io.Serializable {

	/**
	 * Generated serial version.
	 */
	private static final long serialVersionUID = 6003223987245380523L;
	private Integer id;
	private KreditniZahtev kreditniZahtev;
	private Integer brojUgovora;
	private String datumUgovora;

	public UgovorOKreditu() {
	}

	public UgovorOKreditu(Integer id) {
		this.id = id;
	}

	public UgovorOKreditu(Integer id, KreditniZahtev kreditniZahtev,
			Integer brojUgovora, String datumUgovora) {
		this.id = id;
		this.kreditniZahtev = kreditniZahtev;
		this.brojUgovora = brojUgovora;
		this.datumUgovora = datumUgovora;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "UGOVOROKREDITU_SEQ")
	@SequenceGenerator(name = "UGOVOROKREDITU_SEQ", sequenceName = "UGOVOROKREDITU_SEQ")
	@Column(name = "ID", unique = true, nullable = false)
	@NotNull
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "KREDITNIZAHTEVID")
	public KreditniZahtev getKreditniZahtev() {
		return this.kreditniZahtev;
	}

	public void setKreditniZahtev(KreditniZahtev kreditniZahtev) {
		this.kreditniZahtev = kreditniZahtev;
	}

	@Column(name = "BROJUGOVORA")
	public Integer getBrojUgovora() {
		return this.brojUgovora;
	}

	public void setBrojUgovora(Integer brojUgovora) {
		this.brojUgovora = brojUgovora;
	}

	@Column(name = "DATUMUGOVORA", length = 50)
	@Length(max = 50)
	public String getDatumUgovora() {
		return this.datumUgovora;
	}

	public void setDatumUgovora(String datumUgovora) {
		this.datumUgovora = datumUgovora;
	}

}
